#include <iostream>
#include <fstream>
#include <sstream>
#include <memory>
#include <NetworkSnapshotTextDumper.h>
#include <NetworkSnapshotGraphVizDumper.h>
#include <ViewerException.h>
#include "NetworkSnapshotProviderFile.h"
#include "test.h"

/* Tests stability and error handling on invalid xml input  */
int main(int argc, char* argv[]) {
  try {
    std::auto_ptr<INetworkSnapshotProvider> snapshotProvider(
      new NetworkSnapshotProviderFile("invalidInput.xml"));
    std::stringstream errs;
    //here comes errors
    std::auto_ptr<NetworkSnapshot> snapshot(
        snapshotProvider->getSnapshot(errs));
    std::string errsStr = errs.str();
    std::cerr << errsStr;
    assertTrue(errsStr == 
        "Network node IP address is invalid\nInterface IP address is invalid\n");
    std::cout << "Success!" << std::endl;
  } catch(ViewerException& ex) {
    std::cerr << "Error occured: " << std::endl
              << ex.what()         << std::endl;
  }
  return 0;
}
